@extends("layout.main")

@section("content")


    <div class=" col-sm-8 col-md-8 col-lg-8">

        <div class="blog-header">
        </div>

        <div class="row">

            <div class="col-sm-8 blog-main">
                <div class="blog-post">

                    {{--@if(Auth::user()->can('update',$detail))--}}
                    <div style="display:inline-flex">
                        <h2 class="blog-post-title">{{$detail->title}}</h2>
                        @can('update', $detail)

                        <a style="margin: auto" href="/post/edit/{{$detail->id}}">
                            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                        </a>
                        <a style="margin: auto" href="/post/del/{{$detail->id}}">
                            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                        </a>
                        @endcan

                    </div>
                    {{--@endif--}}

                    <p class="blog-post-meta">{{$detail->created_at->toFormattedDateString()}} by <a href="#">{{$detail->user->name}}</a></p>


                    {!! $detail->content !!}

                    <p><br></p>
                    <div>
                        <a href="/post/zan?post_id={{$detail->id}}" type="button" class="btn btn-primary btn-lg">@if($isZan)取消赞@else 赞 @endif</a>

                    </div>
                </div>

                <div class="panel panel-default">
                    <!-- Default panel contents -->
                    <div class="panel-heading">评论</div>

                    <!-- List group -->
                    <ul class="list-group">
                        @foreach($detail->comments as $comment)
                        <li class="list-group-item">
                            <h5>{{$comment->created_at}} by {{$comment->user->name}}</h5>

                            <div>
                                {!! $comment->content !!}
                            </div>
                        </li>
                        @endforeach
                    </ul>
                </div>

                <div class="panel panel-default">
                    <!-- Default panel contents -->
                    <div class="panel-heading">发表评论</div>

                    <!-- List group -->
                    <ul class="list-group">
                        <form action="/post/{{$detail->id}}/comment" method="post">
                           {{csrf_field()}}
                            <input type="hidden" name="post_id" value="62"/>
                            <li class="list-group-item">
                                <textarea name="content" class="form-control" rows="10"></textarea>
                                <button class="btn btn-default" type="submit">提交</button>
                            </li>
                        </form>

                    </ul>
                </div>

            </div><!-- /.blog-main -->
        </div>
    </div>


@endsection